package com.example.service.impl;

import com.example.mapper.EquipmentMapper;
import com.example.pojo.Equipment;
import com.example.pojo.EquipmentOrder;
import com.example.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;


@Service
public class EquipmentServiceImpl implements EquipmentService {

    @Autowired
    private EquipmentMapper equipmentMapper;

    @Override
    public List<Equipment> findAll() {
        return equipmentMapper.findAll();
    }

    @Override
    public Equipment getById(Integer equipmentId) {
        return equipmentMapper.getById(equipmentId);
    }

    @Override
    public Boolean deleteByEquipmentId(Integer equipmentId) {
        return equipmentMapper.deleteByEquipmentId(equipmentId);
    }

    @Override
    public Boolean insertEquipment(Equipment equipment) {
        return equipmentMapper.insertEquipment(equipment);
    }

    @Override
    public Boolean updateEquipmentByEquipmentId(Equipment equipment) {
        return equipmentMapper.updateEquipmentByEquipmentId(equipment);
    }

    @Override
    public List<Equipment> selectByEquipmentId(Integer equipmentId) {
        return equipmentMapper.selectByEquipmentId(equipmentId);
    }

    @Override
    public Integer selectTotalCount() {
        return equipmentMapper.selectTotalCount();
    }

    @Override
    public List<Equipment> findRelaxEquipment() {
        return equipmentMapper.findRelaxEquipment();
    }

    @Override
    public Boolean insertEquipmentOrder(EquipmentOrder order) {
        return equipmentMapper.insertEquipmentOrder(order);
    }

    @Override
    public int updateTime(Timestamp useTime, Integer equipmentOrderId) {
        return equipmentMapper.updateTime(useTime,equipmentOrderId);
    }

    @Override
    public int updateStatus(Integer equipmentId) {
        return equipmentMapper.updateStatus(equipmentId);
    }

    @Override
    public List<EquipmentOrder> getByUserId(Integer userId) {
        return equipmentMapper.getByUserId(userId);
    }

    @Override
    public void deleteOrderedEquipment(Integer equipmentId) {
        equipmentMapper.deleteOrderedEquipment(equipmentId);
    }

    @Override
    public int updateStatusAfterExit(Integer equipmentId) {
        return equipmentMapper.updateStatusAfterExit(equipmentId);
    }

    @Override
    public EquipmentOrder getOrder(Integer equipmentOrderId) {
        return equipmentMapper.getOrder(equipmentOrderId);
    }
}
